package com.androidtest3d.view;

/**
 * Android Game Tutorial Project.
 *
 * Copyright (C) 2011  Philipp Jenke
 * 
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

/**
 * This class accepts user inputs and uses them to control the camera movement.
 */
public class CameraController {

	/**
	 * Speed of the camera movement.
	 */
	private static final double SPEED = 0.03f;

	/**
	 * Reference to the camers object.
	 */
	private final Camera camera;

	/**
	 * Constructor.
	 * 
	 * @param c
	 */
	public CameraController(Camera c) {
		camera = c;
	}

	/**
	 * Mouse was moved (button clicked) in X direction.
	 * 
	 * @param deltaX
	 */
	public void mouseDeltaX(final float deltaX) {
		camera.rotateVertically(deltaX * SPEED);
	}

	/**
	 * Mouse was moved (button down in Y direction.
	 * 
	 * @param deltaY
	 */
	public void mouseDeltaY(final float deltaY) {
		camera.rotateHorizontally(-deltaY * SPEED);
	}
}
